//
//  SVMPBackground.m
//  SilenceVoice
//
//  Created by 张诗宇 on 16/1/29.
//  Copyright © 2016年 张诗宇. All rights reserved.
//

#import "SVMPBackground.h"

@interface SVMPBackground ()<UIScrollViewDelegate>

@property (nonatomic, retain)UIImageView *musicImage;

@property (nonatomic, retain)UILabel *contentText;

@property (nonatomic, retain)UIScrollView *contentScrollV;

@end

@implementation SVMPBackground



/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self createSubviews];
    }
    return self;
}

- (void)createSubviews {
//    SVBaseView *
    
    UIScrollView *backScrollView = [[UIScrollView alloc] init];
    [self addSubview:backScrollView];
    backScrollView.backgroundColor = [UIColor lightGrayColor];
    backScrollView.delegate = self;
    backScrollView.pagingEnabled = YES;
    backScrollView.showsHorizontalScrollIndicator = NO;
    backScrollView.showsVerticalScrollIndicator = NO;
    backScrollView.contentOffset = CGPointMake(0, 0);
    [backScrollView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self).offset(74);
        make.left.equalTo(self).offset(10);
        make.right.equalTo(self).offset(-10);
        
        make.size.mas_equalTo(CGSizeMake(Screen_Width - 20, Screen_Height / 2));
        
        
    }];
    backScrollView.contentSize = CGSizeMake((Screen_Width - 20) * 2, Screen_Height / 2);
    
    self.musicImage = [UIImageView new];
    self.musicImage.backgroundColor = [UIColor cyanColor];
    [backScrollView addSubview:_musicImage];
    
    [self.musicImage mas_makeConstraints:^(MASConstraintMaker *make) {
       
//        make.top.left.bottom.and.right.equalTo(backScrollView).with.insets(UIEdgeInsetsMake(10, 10, 10, 10));
        make.top.equalTo(self).offset(74);

        make.left.equalTo(backScrollView).offset(0);
        
        make.size.mas_equalTo(CGSizeMake(Screen_Width - 20, Screen_Height / 2));
    }];
    
    self.contentScrollV = [[UIScrollView alloc] init];
    [backScrollView addSubview:_contentScrollV];
    [self.contentScrollV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self).offset(74);

        make.left.equalTo(backScrollView).offset(Screen_Width - 20);
        
        make.size.mas_equalTo(CGSizeMake(Screen_Width - 20, Screen_Height / 2));
        
    }];
    self.contentScrollV.pagingEnabled = NO;
    
    self.contentScrollV.contentSize = CGSizeMake(Screen_Width - 20, Screen_Height);
    
    self.contentScrollV.contentOffset = CGPointMake(0, 0);
    
    self.contentScrollV.backgroundColor = [UIColor grayColor];
    
    self.contentScrollV.alpha = 0.4f;
    
}

@end
